
<template>
  <div class="send">
    <el-dialog
      title="选择用户"
      :visible.sync="visible"
      @close="close"
      :showchooseDialog="showchooseDialog"
      class="sendhead"
    >
      <div>
        <div class="top"></div>
        <div class="center">
          <div>
            <el-table
              :data="tableData"
              height="250"
              style="width: 100%"
              highlight-current-row
              @current-change="handleCurrentChange"
            >
              <el-table-column prop="fullname" label="姓名" width="180">
              </el-table-column>
              <el-table-column prop="userNo" label="工号"> </el-table-column>
              <el-table-column prop="account" label="账户"> </el-table-column>
              <el-table-column prop="mobile" label="手机号"> </el-table-column>
            </el-table>
            <div class="page">
              <el-pagination
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange1"
                :page-sizes="[10, 15, 20]"
                :page-size="10"
                layout="sizes, prev, pager, next"
                :total="100"
              >
              </el-pagination>
            </div>
          </div>
        </div>
        <div class="bottom clear" style="text-align: right">
          <el-button size="small" @click="close">取 消</el-button>&nbsp;&nbsp;
          <el-button size="small" type="primary" @click="submit"
            >确 定</el-button
          >
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {transferperson} from '@/api/ywsp/db.js'
export default {
  props: {
    showchooseDialog: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      taskid: "",
      checkList: [],
      visible: this.showchooseDialog,
      opinion: "",
      dynamicTags: ["标签一", "标签二", "标签三"],
      chooseinfo: [],
      //分页
      parameter: {
        limit: 20,
        page: 1,
      },

      // 表格里的假数据
      tableData: [],
      // tableData1:[{
      //   fullname:'wxh',
      //   userNo:'admin',
      //   account:'123',
      //   mobile:'1221'

      // }]
    };
  },
 async created() {
   const res =await transferperson(this.parameter) 
   console.log(res)
   this.tableData=res.data.result.aaData
  //   res.data.result.aaData.forEach(item =>{
  //    return this.tableData.push({fullname:item.fullname,userNo:item.userNo,account:item.account,mobile:item.mobile})
  //  })
  //  console.log(this.tableData)
  },
  watch: {
    showchooseDialog() {
      this.visible = this.showchooseDialog;
    },
  },
  methods: {
    close() {
      this.$emit("update:showchooseDialog", false);
    },
    //关闭tag的方法
    handleClose(tag) {
      this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1);
    },
    handleCurrentChange(val) {
        console.log(val);
      this.currentRow = val;
      this.chooseinfo = val;
      this.$emit("getperson", this.chooseinfo);
    },
    submit() {
      this.close();
    },
     handleSizeChange(val) {
        this.parameter.limit=val
        // console.log(`每页 ${val} 条`);
      },
     handleCurrentChange1(val) {
       this.parameter.page=val
        // console.log(`当前页: ${val}`);
      }
     
  },
};
</script>

<style lang="scss" scoped>
.send {
  /deep/ .sendhead .el-dialog .el-dialog__header {
    height: 42px;
    background: #f4f6f8 !important;
  }
  /deep/.el-dialog__title {
    font-size: 14px;
    color: black;
    font-weight: bold;
  }
  .center {
    margin: 20px 0 0 10px;
  }
}

.bottom {
  margin-top: 30px;
}
.star {
  color: red;
}
.el-tag {
  height: 40px;
  line-height: 40px;
}
.el-dialog__body {
  padding: 10px;
}
.page{
  float: right;
  margin-top:10px;
}
.clear{
  clear:both
}
</style>